package cn.microvideo.videopf.camera.common;

import com.fasterxml.jackson.annotation.JsonInclude;

import java.io.Serializable;

/**
 * rest result class
 *
 * @param <T> data type
 * @author Nacos
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class RestResult<T> implements Serializable {

  private static final long serialVersionUID = 6095433538316185017L;

  private int code = 200;
  private String message = "成功";
  private T data;

  /**
   * Instantiates a new Rest result.
   */
  public RestResult() {
  }

  /**
   * Instantiates a new Rest result.
   *
   * @param code the code
   * @param message the message
   * @param data the data
   */
  public RestResult(int code, String message, T data) {
    this.code = code;
    this.setMessage(message);
    this.data = data;
  }

  /**
   * Instantiates a new Rest result.
   *
   * @param code the code
   * @param data the data
   */
  public RestResult(int code, T data) {
    this.code = code;
    this.data = data;
  }

  /**
   * Instantiates a new Rest result.
   *
   * @param data the data
   */
  public RestResult(T data) {
    this.data = data;
  }

  /**
   * Instantiates a new Rest result.
   *
   * @param code the code
   * @param message the message
   */
  public RestResult(int code, String message) {
    this.code = code;
    this.setMessage(message);
  }

  /**
   * Gets code.
   *
   * @return the code
   */
  public int getCode() {
    return code;
  }

  /**
   * Sets code.
   *
   * @param code the code
   */
  public void setCode(int code) {
    this.code = code;
  }

  /**
   * Gets message.
   *
   * @return the message
   */
  public String getMessage() {
    return message;
  }

  /**
   * Sets message.
   *
   * @param message the message
   */
  public void setMessage(String message) {
    this.message = message;
  }

  /**
   * Gets data.
   *
   * @return the data
   */
  public T getData() {
    return data;
  }

  /**
   * Sets data.
   *
   * @param data the data
   */
  public void setData(T data) {
    this.data = data;
  }


}
